package com.t235.gc.device.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.t235.gc.AjaxResult;
import com.t235.gc.device.service.RecyclersService;
import com.t235.gc.entity.Recyclers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/recyclers")
public class RecyclersController {

    @Autowired
    private RecyclersService recyclersService;

    @GetMapping("/admin/getBackRecyclersList")
    public AjaxResult getBackRecyclersList(Recyclers recyclers, @RequestParam(value = "page",defaultValue = "0")Integer pageNo, @RequestParam(value = "limit",defaultValue = "2")Integer pageSize) throws Exception{
        PageHelper.startPage(pageNo,pageSize);
        List<Recyclers> cs = recyclersService.getBackRecyclersList(recyclers);
        PageInfo<Recyclers> pageInfo = new PageInfo<>(cs);
        return AjaxResult.success(pageInfo);
    }
}
